using System;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Identity;
using Volo.Abp.Uow;
using UserManagementService.Users;

namespace UserManagementService.Events;

/// <summary>
/// 用户创建事件
/// </summary>
public class UserCreatedEto
{
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
    public string? Name { get; set; }
    public string? Surname { get; set; }
    public Guid? TenantId { get; set; }
    public DateTime CreationTime { get; set; }
}

/// <summary>
/// 用户更新事件
/// </summary>
public class UserUpdatedEto
{
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
    public string? Name { get; set; }
    public string? Surname { get; set; }
    public Guid? TenantId { get; set; }
    public DateTime ModificationTime { get; set; }
}

/// <summary>
/// 用户状态变更事件
/// </summary>
public class UserStatusChangedEto
{
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public UserStatus OldStatus { get; set; }
    public UserStatus NewStatus { get; set; }
    public Guid? TenantId { get; set; }
    public DateTime ChangeTime { get; set; }
    public string? ChangeReason { get; set; }
}

/// <summary>
/// 用户登录事件
/// </summary>
public class UserLoginEto
{
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public string? TenantId { get; set; }
    public DateTime LoginTime { get; set; }
    public string? ClientId { get; set; }
    public string? ClientIpAddress { get; set; }
    public string? BrowserInfo { get; set; }
    public bool IsSuccess { get; set; }
    public string? FailureReason { get; set; }
}

/// <summary>
/// 用户角色变更事件
/// </summary>
public class UserRoleChangedEto
{
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public List<string> AddedRoles { get; set; } = new();
    public List<string> RemovedRoles { get; set; } = new();
    public Guid? TenantId { get; set; }
    public DateTime ChangeTime { get; set; }
    public string? ChangedBy { get; set; }
}

/// <summary>
/// 用户密码变更事件
/// </summary>
public class UserPasswordChangedEto
{
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
    public Guid? TenantId { get; set; }
    public DateTime ChangeTime { get; set; }
    public string? ChangedBy { get; set; }
    public bool ForceChangeOnNextLogin { get; set; }
}

/// <summary>
/// 用户删除事件
/// </summary>
public class UserDeletedEto
{
    public Guid UserId { get; set; }
    public string UserName { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
    public Guid? TenantId { get; set; }
    public DateTime DeletionTime { get; set; }
    public string? DeletedBy { get; set; }
    public string? DeletionReason { get; set; }
}